﻿using System;
using System.ComponentModel;
using System.Web.UI;
using System.Collections;
using System.Collections.Generic;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.Core;

namespace Yuanlin.Business
{
    public class ParentFriendLinkCategories : YuanlinUserControl,
        IReplyConverter<FriendLinkCategoryReply, GetListOperation>
    {
        protected Repeater list;
        private EntityList friendLinkCategorys;

        public override void GetRequests(List<BaseRequestBinder> requestBinders)
        {
            if (!IsPostBack)
            {
                requestBinders.Add(RequestHelper.BuildGetFriendLinkCategoryListRequest(this));
            }
        }

        private void BindData()
        {
            list.DataSource = friendLinkCategorys;
            list.DataBind();
        }

        #region IReplyConverter<FriendLinkCategoryReply,GetListOperation> Members

        public void ConvertReply(FriendLinkCategoryReply reply, GetListOperation operation)
        {
            if (reply != null)
            {
                friendLinkCategorys = reply.EntityList;

                if (!IsPostBack)
                {
                    BindData();
                }
            }
        }

        #endregion
    }
}
